<template>
	<view>
		<uni-search-bar @confirm="search" bgColor="#fff" v-model="searchValue" @input="input" @cancel="cancel"
			@clear="clear">
		</uni-search-bar>
		<orderList :orderList="orderList" @toDetail="toOrderDetail" @toComment="toComment"></orderList>
	</view>
</template>

<script>
	import {
		getMyOrderListApi
	} from '@/api/index.js'
	import orderList from './components/orderList.vue';
	export default {
		components: {
			orderList,
		},
		data() {
			return {
				searchValue: "",
				orderList: [],
			}
		},
		onLoad(e) {
			console.log(e);


		},
		onShow() {
			this.getMyOrderList()

		},
		onHide() {

		},
		mounted() {

		},
		methods: {
			// 商品订单列表
			async getMyOrderList() {
				try {
					const {
						data: res
					} = await getMyOrderListApi(this.searchData);
					console.log(res);
					if (res.state === true) {
						this.orderList = res.Order;
					}
				} catch (e) {}
			},
			// 跳转订单详情
			toOrderDetail(item) {
				// console.log(item);
				uni.navigateTo({
					url: '/pages/orderDetail/orderDetail?item=' + JSON.stringify(item)
				})
			},
			// 跳转评价
			toComment(item) {
				// console.log(item);
				uni.navigateTo({
					url: '/pages/comment/comment?item=' + JSON.stringify(item)
				})
			},

		},
	}
</script>

<style>
</style>